﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace VideoCarousel
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        public App(): base() 
        {
            Entity.SqlSugarHelp.CreateTable(typeof(Entity.mediaInfo));
            if (VCLib.Util.ConfigHelp.ReadConfig("appType") == "audio")
            {
                StartupUri = new Uri("AudioWindow.xaml", UriKind.Relative);
            }
            else 
            {
                if (VCLib.Util.ConfigHelp.ReadConfig("decode") == "vlc")
                {
                    StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
                }
                else
                {
                    StartupUri = new Uri("NetPlay.xaml", UriKind.Relative);
                }
            }
            
           
           
        }
        private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            MessageBox.Show(e.Exception.ToString());
            VCLib.Util.LogHelp.Write("");
            VCLib.Util.LogHelp.Write("--------------------");
            VCLib.Util.LogHelp.Write("error",e.Exception);
            VCLib.Util.LogHelp.Write("--------------------");
            VCLib.Util.LogHelp.Write("");
        }
    }
}
